package self.wiki.controller;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.util.ResourceUtils;

import java.io.File;
import java.io.FileNotFoundException;
import java.util.HashMap;
import java.util.Map;


/**
 * Created by werewolf on 2017/7/25.
 */
@SpringBootApplication
public class Application {
    public static final Map<String, File> files = new HashMap();

    public static void main(String[] args) {
        try {
            File file = ResourceUtils.getFile("classpath:doc");
            getFile(file);
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
        SpringApplication.run(Application.class, args);
    }

    private static void getFile(File f) {
        if (f != null) {
            if (f.isDirectory()) {
                File[] fileArray = f.listFiles();
                if (fileArray != null) {
                    for (int i = 0; i < fileArray.length; i++) {
                        getFile(fileArray[i]);
                    }
                }
            } else {
                System.out.println(f.getName());
                files.put(f.getName(), f);
            }
        }
    }


}
